Skip to main content

ComponentTests

Area Chart – Component test plan

Sub-components: Area, x-axis, y-axis and Legend

  1. Line: Area data, Area color (multi colors), Area label (show/hide)
  2. Legends: show/hide legends, highlight the corresponding Area on legend hover
  3. Callout: Default/custom callout
  4. Labels: x-Axis labels, y-Axis labels
Test stepsValidationTool used
Test 1: [Snapshot testing]
- With only data prop, numerical data on x-axis.Renders Area chart correctlyRTL
- With only data prop, date data on x-axis.Renders Area chart correctlyRTL
- With only data prop, string data on x-axis.Should not render area chartPending
- With HideLegend prop set to “true”Should hide legendsEnzyme
- With HideTooltip prop set to “true”Should hide the tooltip in chartEnzyme
- With EnabledLegendsWrapLines set to “true”Should enable the legends to wrap lines if there is not enough space to show all legends on a single lineEnzyme
- With ShowXAxisLablesTooltip set to “true”Should truncate x axis labels and show tooltip on x axis labelsEnzyme
- With WrapXAxisLables set to “true”Should wrap x axis label valuesEnzyme
- With yAxisTickFormat set to “%d”

Should render the y-axis ticks in the format specified

Enzyme
- With single pointShould render Area chat with single pointEnzyme
- With Default colorShould render with default colors when line color not providedEnzyme
- With specific colorsShould render areas with specified colorsRTL
- With optimizeLargeData set to “true”Should not render circles when optimizeLargeData is trueEnzyme
Test 2: Basic props testing
- HideLegend prop set to “true”Should not mount legend when hideLegend is trueEnzyme
- HideLegend prop set to “false”Should mount legend when hideLegend is falseEnzyme
- HideTooltip prop set to “true”Should not mount callout when hideTootip is trueEnzyme
- HideTooltip prop set to “false”Should mount callout when hideTootip is falseEnzyme
- onRenderCalloutPerStack prop is not givenShould not render onRenderCalloutPerStackEnzyme
- onRenderCalloutPerDataPoint is givenShould render onRenderCalloutPerDataPointEnzyme
- onRenderCalloutPerDataPoint is not givenShould not render onRenderCalloutPerDataPointEnzyme
Test 3: Render calling with respective to props
- No prop changes: Mount Area chart and then set the same props againRender function should have been called twiceEnzyme
- Prop changes: Mount Area chart and then set some other propRender function should have been called twiceEnzyme
Test 4: Mouse events
- Mouse over on AreaShould render callout correctly on mouseoverEnzyme
- Mouse move from one area to other areaShould render callout correctly on mouse moveEnzyme
- Mouse over on a area with customized calloutShould render customized callout on mouseoverEnzyme
- Customized callout on area from one area to other areaShould render customized callout for stack on mouseoverEnzyme
Test 5: Render empty chart aria label div when chart is empty
- Area chart mounted with non-empty dataNo empty chart aria label div renderedEnzyme
- Area chart mounted with empty dataEmpty chart aria label div renderedEnzyme
Test 6: [Sub-Component]: Legends
- Hover mouse over area legendsShould reduce the opacity of the other AreasRTL
- Hover mouse over area legendsShould reduce the opacity of the other lines in area chart and opacity of the selected area line should be zeroRTL
- Hover mouse over area legendsShould reduce the opacity of the other legendsRTL
- Single mouse click on legendsShould select legend on single mouse click on respective legendRTL
- Double mouse click on legendsShould deselect legend on double mouse click on respective legendRTL
Test 7: [Sub-Component]: Callout
- Hover mouse over a single areaShould show the default callout over that AreaRTL
- Hover mouse over a stacked areaShould show the default stacked callout over that AreaRTL
- Specify custom callout and hover mouse over a AreaShould show the custom callout over that AreaRTL
Test 8: [Sub-Component]: x-axis labels
- Truncate x-axis labelsShould show the x-axis labels tooltip when hoveredRTL
- Rotate x-axis labelsShould rotate the x-axis labels by 39 degreesRTL
Test 9: [Sub-Component]: Screen resolution
- Increase the screen resolution (zoom in)Should remain unchanged on zoom inRTL
- Decrease the screen resolution (zoom out)Should remain unchanged on zoom outRTL
Test 10: Theme changed to Dark ThemeShould reflect theme changeRTL